/*
 * @Author: Warren
 * @Date: 2025-01-02 17:51:12
 * @LastEditors: Warren
 * @LastEditTime: 2025-06-09 11:45:48
 * @FilePath: /nest-web/src/modules/user/user.controller.ts
 * @Description: 请填写文件说明
 */
import { Body, Controller, Get, HttpCode, Param, Post } from '@nestjs/common';
import { UserService } from './user.service';
import { User } from 'src/entities/user.entity';
import { UpdateUserDto } from './dto/update-user.dto';

@Controller('/user')
export class UserController {
    constructor(private readonly userService: UserService) {

    }

    /* 获取所有用户信息 */
    @Get()
    async findAllUsers():Promise<User[]> {
        return this.userService.findAll();
    }

    /* 获取单个用户信息 */
    @Get(':id')
    findUser(@Param('id') id: number): Promise<User> {
        return this.userService.findOneId(id)
    }
    
    
    /* 更新用户信息 */
    @Post()
    /* POST 请求 默认为 201 状态 需要改为 200 */
    @HttpCode(200)
    updateUserInfo(@Body() updateUserDto: UpdateUserDto){
        console.log(updateUserDto);
        return 'success'
    }
}
